import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'
// https://vitejs.dev/config/
export default defineConfig({
  server: {
    proxy: {
      "/yi-cloud-security-network": {
        target: "http://135.31.65.228:8090",
        changeOrigin: true,
        // rewrite: (path) => path.replace(/^\/api/, ""),
      },
    },
    hmr:true,
  },
  plugins: [react()],
  resolve: {
    alias: [
      { find: '@', replacement: path.resolve('./', 'src') },
      { find: /^~antd/, replacement: path.resolve('./', 'node_modules/antd/') },
    ],
  },
  css: {
    modules: { 
      generateScopedName: '[local]_[hash:base64:5]',
      hashPrefix: 'prefix',
    },
    preprocessorOptions: {
      less: {
        charset: false,
        modifyVars: {
          'primary-color': '#024e78',
          // 'link-color': '#0080FF',
          // 'border-radius-base': '4px',
        },
        javascriptEnabled: true,
      },
    },

  }
})
